package com.gexiaobao.pigeon.ui.adapter

import com.chad.library.adapter.base.BaseQuickAdapter
import com.gexiaobao.pigeon.R
import com.gexiaobao.pigeon.app.base.DataBindBaseViewHolder
import com.gexiaobao.pigeon.app.model.bean.BaseSignListResponse
import com.gexiaobao.pigeon.app.model.bean.ItemList
import com.gexiaobao.pigeon.databinding.ItemListOfAwardsNamesBinding

/**
 * @Author      : hxw
 * @Date        : 2024/7/20 10:33
 * @Describe    :
 */
class AdapterListOfAwardsNames : BaseQuickAdapter<ItemList, DataBindBaseViewHolder>(R.layout.item_list_of_awards_names) {

    private var mOnItemClickListener: OnItemClickListener? = null

    override fun convert(holder: DataBindBaseViewHolder, item: ItemList) {
        val binding = DataBindBaseViewHolder.getBinding(holder) as ItemListOfAwardsNamesBinding
        binding.data = item
        binding.executePendingBindings()//防止列表抖动

        holder.itemView.setOnClickListener {
            mOnItemClickListener?.onItemClick(item.projectId, item.groupName)
        }
    }

    fun setOnItemClickListener(listener: OnItemClickListener?) {
        mOnItemClickListener = listener
    }

    interface OnItemClickListener {
        fun onItemClick(projectId: Int, groupTitle: String)
    }

}